import request from "@/utils/request";

// 登录
export function getTree(params) {
  return request({
    url: "/targetManagement/tree",
    method: "get",
    params,
  });
}

// 申报组织详情概况
export function getDeclarationInfoDetail(id) {
  return request({
    url: `/declarationInfo/getDeclarationInfoDetail/${id}`,
    method: "get",
  });
}

// 根据申报体系查询社会组织指标填报列表
export function getTargetDeclarationRecordList(params) {
  return request({
    url: `/targetDeclarationRecord/page`,
    method: "get",
    params,
  });
}

// 根据指标填报记录id查询指标填报详情
export function getTargetDeclarationRecordDetail(id) {
  return request({
    url: `/targetDeclarationRecord/${id}`,
    method: "get",
  });
}

// 填报指标
export function submitDeclare(data) {
  return request({
    url: `/targetDeclarationRecord`,
    method: "post",
    data,
  });
}

// 填报指标
export function editDeclare(data) {
  return request({
    url: `/targetDeclarationRecord`,
    method: "put",
    data,
  });
}

// 指标详情
export function getTargetManagement(id) {
  return request({
    url: `/targetManagement/${id}`,
    method: "get",
  });
}

// 根据填报id查询合并后文件
export function getFiles(targetDeclarationRecordId) {
  return request({
    url: `/targetDeclarationRecordFile/getFile/${targetDeclarationRecordId}`,
    method: "get"
  });
}

// 根据填报id查询合并前文件
export function getFilesBefore(targetDeclarationRecordId) {
  return request({
    url: `/targetDeclarationRecordFile/getFiles/${targetDeclarationRecordId}`,
    method: "get"
  });
}

// 下载并合并文件
export function getAllFile(params) {
  return request({
    url: `/declarationInfo/getAllFile`,
    method: "get",
    params
  });
}

// 修改指标推送消息
export function updateStatus(params) {
  return request({
    url: `/targetDeclarationRecord/checkUpdateStatus`,
    method: "get",
    params
  });
}

// 预览文件
export function previewFile(params) {
  return request({
    url: `/declarationInfo/getAllFileV2`,
    method: "get",
    params
  });
}


// 获取异步文件状态
export function getTaskFileStatus (taskId) {
  return request({
    url: `/declarationInfo/checkHeartbeat/${taskId}`,
    method: 'get'
  })
}
